package com.chixing;

import org.mybatis.spring.annotation.MapperScan;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@MapperScan("com.chixing.mapper")
@EnableConfigurationProperties
@EnableCaching
@EnableScheduling  // 开启任务调度器
public class ShandianmiaoshaApplication {

    public static void main(String[] args) {
        SpringApplication.run(ShandianmiaoshaApplication.class, args);
    }

    @Bean
    public Redisson redisson(){
//        单机模式
        Config config = new Config();
        config.useSingleServer().setAddress("redis://localhost:6379").setDatabase(0);
        return (Redisson) Redisson.create(config);
    }


}
